import request from '@/utils/request'

// api地址
const api = {
  logins: 'passport/logins', //登录接口
  registers: 'passport/registers',//注册接口
  getAgreement: 'setting/getAgreement', //获取用户协议
  retrieve: 'passport/retrieve', //找回密码
  wasteCategory: 'waste_category/list', //获取商品分类
  help: 'help/list', //公告内容列表
  getWaste: 'waste/list', //根据废品id获取废品列表
  categoryList: 'article.category/list', //消息分类
  articleList: 'article/list', //消息列表
  articleDetail: 'article/detail', //消息详情
  serviceList: 'goods.service/list', //选择预估重量展示接口
  getInfoBank: 'bank_card/getInfo', //获取银行卡信息
  bankList: 'bank_card/list', //银行卡列表
  bankEdit: 'bank_card/edit', //编辑银行卡
  bankAdd: 'bank_card/add', //添加银行卡
  bankdel: 'bank_card/delete', //删除银行卡
  serviceDetail: 'goods.service/detail', //预估重量获取详情接口
  createOrder: 'waste_order/create', //创建订单
  readOrder: 'waste_order/read', //订单详情
  indexOrder: 'waste_order/index', //订单列表
  reasonOrder: 'waste_order/reason', //取消订单原因
  cancelOrder: 'waste_order/cancel', //取消订单
  getAbout: 'setting/getAbout', //获取关于我们
  upImage: 'upload/image', //图片上传
  createFeedBack: 'feedback_content/create', //生成反馈内容
  feedList: 'feedback_content/feedlist', //获取反馈类型
  getPoints: 'points.log/getPoints', //我的积分
  sign_list: 'signin_log/list', //签到列表
  sign_log: 'signin_log/sign', //签到接口
  cashList: 'cash/list', //签到接口
  getMoney: 'cash_apply/getMoney', //银行卡提现
  updateInfo: 'user/updateInfo', //修改个人信息
  waste_categoryImage: 'waste_category/image', //轮播图
  changeAvatar: 'user/changeAvatar', //轮播图
}

// 获取商品分类
export const wasteCategory = (param, option) => {
  const options = {
    isPrompt: true, //（默认 true 说明：本接口抛出的错误是否提示）
    load: true, //（默认 true 说明：本接口是否提示加载动画）
    ...option
  }
  return request.get(api.wasteCategory, param, options)
}

// 登录接口
export const logins = (param, option) => {
  return request.post(api.logins, param, option)
}
// 注册接口
export const registers = (param, option) => {
  return request.post(api.registers, param, option)
}
// 获取用户协议
export const getAgreement = (param, option) => {
  return request.get(api.getAgreement, param, option)
}
// 找回密码
export const retrieve = (param, option) => {
  return request.post(api.retrieve, param, option)
}
// 公告内容列表
export const help = (param, option) => {
  return request.get(api.help, param, option)
}

// 根据废品id获取废品列表
export const getWaste = (param, option) => {
  return request.get(api.getWaste, param, option)
}
//  消息分类
export const categoryList = (param, option) => {
  return request.get(api.categoryList, param, option)
}
// 消息列表
export const articleList = (param, option) => {
  return request.get(api.articleList, param, option)
}
// 消息详情
export const articleDetail = (param, option) => {
  return request.get(api.articleDetail, param, option)
}
// 选择预估重量展示接口
export const serviceList = (param, option) => {
  return request.get(api.serviceList, param, option)
}
// 获取银行卡信息
export const getInfoBank = (param, option) => {
  return request.get(api.getInfoBank, param, option)
}
// 银行卡列表
export const bankList = (param, option) => {
  return request.get(api.bankList, param, option)
}
// 编辑银行卡
export const bankEdit = (param, option) => {
  return request.get(api.bankEdit, param, option)
}
// 新增银行卡
export const bankAdd = (param, option) => {
  return request.get(api.bankAdd, param, option)
}
// 删除银行卡
export const bankdel = (param, option) => {
  return request.get(api.bankdel, param, option)
}
// 预估重量获取详情接口
export const serviceDetail = (param, option) => {
  return request.get(api.serviceDetail, param, option)
}
// 创建订单
export const createOrder = (param, option) => {
  return request.post(api.createOrder, param, option)
}


// 获取订单详情
export const readOrder = (param, option) => {
  return request.get(api.readOrder, param, option)
}
// 获取订单列表
export const indexOrder = (param, option) => {
  return request.get(api.indexOrder, param, option)
}

// 取消订单原因
export const reasonOrder = (param, option) => {
  return request.get(api.reasonOrder, param, option)
}

// 取消原因
export const cancelOrder = (param, option) => {
  return request.get(api.cancelOrder, param, option)
}

// 关于我们
export const getAbout = (param, option) => {
  return request.get(api.getAbout, param, option)
}

// 图片上传
export const upImage = (param, option) => {
  return request.get(api.upImage, param, option)
}
// 生成反馈内容
export const createFeedBack = (param, option) => {
  return request.get(api.createFeedBack, param, option)
}
// 获取反馈类型
export const feedList = (param, option) => {
  return request.get(api.feedList, param, option)
}

// 我的积分
export const getPoints = (param, option) => {
  return request.get(api.getPoints, param, option)
}
// 签到列表
export const sign_list = (param, option) => {
  return request.get(api.sign_list, param, option)
}
// 签到接口
export const sign_log = (param, option) => {
  return request.get(api.sign_log, param, option)
}

// 提现金额
export const cashList = (param, option) => {
  return request.get(api.cashList, param, option)
}

// 銀行卡提現
export const getMoney = (param, option) => {
  return request.get(api.getMoney, param, option)
}

// 修改个人信息
export const updateInfo = (param, option) => {
  return request.get(api.updateInfo, param, option)
}

// 绑定手机号
export const bindMobile = (data, option) => {
  return request.post(api.bindMobile, data, option)
}

// 轮播图
export const waste_categoryImage = (param, option) => {
  return request.get(api.waste_categoryImage, param, option)
}

// 轮播图
export const changeAvatar = (param, option) => {
  return request.get(api.changeAvatar, param, option)
}
